package java基础知识.线程的创建;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @author coderFu
 * @create 2022/3/12
 * 线程的创建
 */
public class CoderThread extends Thread {

    public static void main(String[] args) throws ExecutionException, InterruptedException {

        // 直接继承Thread 进行线程的创建

        CoderThread coderThread = new CoderThread();
        coderThread.start();

       new Thread(new CoderRunnable(),"coder").start();

       Callable<Integer> callable;
       callable = new CoderCallable();
       FutureTask<Integer> futureTask = new FutureTask<>(callable);

       new Thread(futureTask).start();
        Integer integer = futureTask.get();

        System.out.println(integer);

    }

    @Override
    public void run() {
        System.out.println("执行了线程的Run方法");
    }
}
